<?php
//wp-content/plugins/courses/courses.phpj
/*
Plugin Name: courses
Plugin URI: http://1webuniver.ru/wordpress/plugins/courses/
Description: managing courses.
Author: arsaa
Version: 1.0.0
Author URI: http://1webuniver.ru/
Tags: courses, learning
Copyright (C) 2011 1web-university
*/




 function add_courses_Styles(){
    wp_enqueue_style("CursUITheme","/wp-content/themes/tpfud_theme/templates/stol/ui_themes/hot-sneaks/hot-sneaks.css",false,'1.0',"screen");
    wp_enqueue_style('CoursesAdmin',"/wp-content/plugins/courses/style/courseadmin.css",false,'1.0','screen');

     //По непонятной причине через функцию загружается только файл сupertino.css
    // поэтому загрузка других файлов пока делается прямо через wp-admin/admin_header.php
   //wp_enqueue_style('UI_css',WP_PLUGIN_URL."/courses/style/ui_themes/hot-sneaks/hot-sneaks.css");
   /*wp_enqueue_style('UI_css',WP_PLUGIN_URL.'/courses/style/ui_themes/cupertino/cupertino.css');*/
   wp_enqueue_style('tree_css',WP_PLUGIN_URL.'/courses/style/tree_js.css');


        }

function add_courses_Scripts(){
   
    wp_enqueue_script('widget','http://webuniver/wp-includes/js/jquery/ui/jquery.ui.widget.js',array('jquery'));
    wp_enqueue_script('tabs','http://webuniver/wp-includes/js/jquery/ui/jquery.ui.tabs.js',array('jquery'));
    wp_enqueue_script('CoursesManager','/wp-content/plugins/courses/js/courseadmin_v8.js');
    wp_enqueue_script('CoursesDNDtable','/wp-content/plugins/courses/js/jquery.tablednd_0_5.js');

  }



add_action('admin_menu', 'courses_menu_page');

function courses_menu_page() {
	if ( isset( $_GET['page'] ) && $_GET['page'] == basename(__FILE__) ) {

		//add_action('admin_head', 'load_select_script');
		add_action('admin_print_styles', 'add_courses_Styles');
       add_action('wp_print_scripts', 'add_courses_Scripts');

	}
	$min_cap = 'read';
	add_menu_page(__('Курсы :: Панель управления'), __('Course Manager'), 'administrator', basename(__FILE__), 'course_admin_page');
        add_submenu_page('courses.php', 'Pages', 'Pages', $min_cap, 'course_pages', 'pages_admin');
	

}


function course_admin_page() {
    include_once WP_PLUGIN_DIR."/courses/kurs_admin_panel_v8.php";
    echo panel_htm();
}

function pages_admin(){
include_once WP_PLUGIN_DIR."/courses/kurs_admin_pages.php";
    echo pages_htm();
}


add_action('wp_ajax_courses_data_manage', 'manage_courses_ajax_request');


?>